package com.bdqn.demo;
import org.junit.After;
import static org.junit.Assert.assertNull;
public class Test {
    private JedisAPI jedisAPI;
    @org.junit.Before
    public void startUp() throws Exception{
        jedisAPI = new JedisAPI();
    }
    @After
    public void tearDown() throws Exception {
        if (jedisAPI != null) {
            jedisAPI.destroy();
        }
    }
    @org.junit.Test
    public void test(){
        /**
         * 第四章实战5
         */
       jedisAPI.set("1","曹操");
        System.out.println(jedisAPI.get("1"));
        jedisAPI.set("2","随风");
        System.out.println(jedisAPI.get("2"));
        jedisAPI.delete("2");
        System.out.println(jedisAPI.exists("2")? "删除失败" : "删除成功");
        /**
         * 第四章简答
         */
        System.out.println(jedisAPI.set("3", 1000, "李白")? "超时时间设置成功" : "超时时间设置失败");
        System.out.println("超时时间剩余："+jedisAPI.ttl("3")+"毫秒");
    }
}
